postgresql: fix fails to start on mounted data directories
authorPeiying Huang <[email protected]>
Tue, 12 Aug 2025 06:12:00 +0000 (14:12 +0800)
committerHannu Nyman <[email protected]>
Sat, 25 Oct 2025 05:37:54 +0000 (08:37 +0300)
This commit resolves a bug where the PostgreSQL service failed to start
during the boot process when its data directory ($pgdata) was on a
partition mounted via `/etc/fstab`.
Because the filesystem is already mounted, no hotplug event is ever
triggered, and the PostgreSQL service mistakenly waits for an event
that will never happen.
This fix adds a check to ensure the script does not skip starting the
service if the data directory is on a mount point.

Signed-off-by: Peiying Huang <[email protected]>
libs/postgresql/Makefile
libs/postgresql/files/postgresql.init

index 9db0e760604a1b2c35f5f9a1591e7d9cbd2d7c68..6cdbab9cde2229574ccebdfd9b4cc5e92ebbb65e 100644 (file)
@@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=postgresql
 PKG_VERSION:=17.5
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_MAINTAINER:=Daniel Golle <[email protected]>
 PKG_LICENSE:=PostgreSQL
 PKG_CPE_ID:=cpe:/a:postgresql:postgresql
index 57613364fad76f60af35d87776c20e133d182b1b..e8cf8d8ee879ec5cfe093800c1770ef16c00fdbe 100644 (file)
@@ -32,8 +32,12 @@ start_service() {
        user_exists postgres 5432 || user_add postgres 5432
        group_exists postgres 5432 || group_add postgres 5432
 
+       local mountpoint="$(procd_get_mountpoints "${pgdata}")"
+
        [ "$_BOOT" = "1" ] &&
-               [ "$(procd_get_mountpoints $pgdata)" ] && return 0
+               [ "$mountpoint" ] &&
+               ! grep -q ".* $mountpoint " /proc/mounts &&
+               return 0
 
        fix_perms
        fix_hosts